﻿@{
    ViewBag.Title = "ShopPage";
}

<h2>@ViewBag.Shop</h2>


<li>
    <h5>You can leave a message for this shop:</h5>
    <p>
        <textarea id="LeaveMessage" wrap="soft" style="width: 200px;"></textarea>
    </p>
    <p>
        <input type="button" value="clear" onclick="ClearMessageBtn_OnClick()" />
        <input type="button" value="ok" onclick="LeaveMessageBtn_OnClick()" />
    </p>
</li>










<script type="text/javascript">

    function LeaveMessageBtn_OnClick() {
        var message = $("#LeaveMessage").val();
        $.ajax({
            type: "POST",
            url: "/Home/LeaveMessage",
            datatype: "json",
            async: false,
            data: { "str": message },
            success: function (result) {
                if ("True" == result) {
                    alert("u can't leave null message.");
                }
                else {
                    $("#displayMessage").append(result);
                }

            },
            error: function (error) {
            }
        });
    }

    function ClearMessageBtn_OnClick() {
        var message = $("#LeaveMessage").val("");
    }
</script>
